<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>营业统计</title>
    <style>
    
    body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 0;
        }

        .navbar {
            background-color: #d2a679;
            overflow: hidden;
            border-bottom: 2px solid #ccc;
        }

        .navbar a {
            float: left;
            display: block;
            color: #000;
            text-align: center;
            padding: 14px 20px;
            text-decoration: none;
            font-size: 17px;
        }

        .navbar a:hover {
            background-color: #ddd;
            color: black;
        }

        .navbar a.active {
            background-color: #ff704d;
            color: white;
        }

        .container {
            max-width: 800px;
            margin: 20px auto;
            padding: 20px;
            background-color: #fff;
            border-radius: 5px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }
    
    
        body {
            font-family: Arial, sans-serif;
            background-color: #f9f9f9;
            margin: 0;
            padding: 0;
        }

        .container {
            max-width: 800px;
            margin: 20px auto;
            padding: 20px;
            background-color: #fff;
            border-radius: 5px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        h1 {
            margin-bottom: 20px;
            color: #333;
            text-align: center;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th, td {
            border: 1px solid #ccc;
            padding: 10px;
            text-align: center;
        }

        tr:nth-child(even) {
            background-color: #f2f2f2;
        }

        tr:hover {
            background-color: #ddd;
        }
    </style>
</head>
<body>

<div class="navbar">
        <a href="Order Status.jsp">点餐状态</a>
        <a href="BOH.jsp">后厨状态</a>
        <a href="order.jsp">今日订单</a>
        <a href="Menu Management.jsp">菜品管理</a>
        <a href="Sales Statistics.jsp" class="active">营业统计</a>
        <a href="aboutme.jsp">我的</a>
    </div>


<div class="container">
    <h2>营业统计</h2> 
<table width="100%" border="1">
<tr>
            <th>桌号</th>
            <th>菜品id</th>  
            <th>菜品名称</th>
            <th>数量</th>  
            <th>价格</th>  
        

    
<%

javax.sql.rowset.WebRowSet rs = com.myweb.DBTools.getRS("SELECT * FROM cart");
while(rs.next()){
%>
<tr onclick="fillform(this)" style="cursor:pointer">
<td><%=rs.getString("table_id")%></td>
<td><%=rs.getString("dish_id")%></td>
<td><%=rs.getString("name")%></td>
<td><%=rs.getString("amount")%></td>
<td><%=rs.getString("price")%></td>

</tr>
<%
}
rs.close();
%>
</table> 

<script>
function fillform(row) {
	document.forms[0].table_id.value = row.children[0].innerText;
    document.forms[0].dish_id.value = row.children[1].innerText;
    document.forms[0].dish_name.value = row.children[2].innerText;
    document.forms[0].amount.value = row.children[3].innerText;
    document.forms[0].price.value = row.children[4].innerText;
} 
</script>


</body>
</html>